const app = getApp();

Page({

    /**
     * 页面的初始数据
     */
    data: {
        navTo: '',
        marginTop: '',
        name: '首页',
        mtt: '',
        ntt: '',
        hasLoginOwnsys: null
    },

    /**
     * 生命周期函数--监听页面加载
     */
    onLoad: function (options) {
        let that = this
        that.getuserHasLogin()
        that.setData({
            name: options.name,
            mtt: app.globalData.statusBarHeight,
            ntt: app.globalData.navHeight,
            marginTop: app.globalData.statusBarHeight + 'px',
            navTo: app.globalData.navHeight + 'px'
        })
        // that.getuserHasLogin()
    },
    announcement(e) {
        wx.navigateTo({
            url: '../announcement/announcement'
        });
    },
    testing_facility() {
        wx.navigateTo({
            url: '../testing_facility/testing_facility'
        });
    },
    regulated_enterprise(e) {
        wx.navigateTo({
            url: '../regulated_enterprise/regulated_enterprise'
        });
    },
    early(e){
        wx.navigateTo({
            url: '../early_warning/early_warning'
        });
    },
    getuserHasLogin() {
        let that = this
        wx.getStorage({
            key: 'uinfo',
            success: (res) => {
                console.log(res)
                that.setData({
                    userinfo: res.data.userInfo,
                })
            },
            fail: () => {
                wx.navigateTo({
                    url: '../authorize/authorize'
                });
            },
            complete: () => {}
        });

    },
    Gotback() {
        wx.navigateBack({
            delta: 1,
        })
    },
    gotologin(e) {
        console.log(1)
        wx.navigateTo({
            url: '../bindphone/bindphone'
        });
    },
    gotoMap() {
        wx.navigateTo({
            url: '../index/index'
        });
    },
    gotoTable(e) {
        wx.navigateTo({
            url: '../lawtables/lawtables'
        });
    },
    gotoMonitor() {
        wx.navigateTo({
            url: '../monitor/monitor'
        });
    },

    gotoMine() {
        wx.navigateTo({
            url: '../mine/mine'
        });
    },
    /**
     * 生命周期函数--监听页面初次渲染完成
     */
    onReady: function () {

    },

    /**
     * 生命周期函数--监听页面显示
     */
    onShow: function () {

    },

    /**
     * 生命周期函数--监听页面隐藏
     */
    onHide: function () {

    },

    /**
     * 生命周期函数--监听页面卸载
     */
    onUnload: function () {

    },

    /**
     * 页面相关事件处理函数--监听用户下拉动作
     */
    onPullDownRefresh: function () {

    },

    /**
     * 页面上拉触底事件的处理函数
     */
    onReachBottom: function () {

    },

    /**
     * 用户点击右上角分享
     */
    onShareAppMessage: function () {

    }
})